package org.dei.perla.rockfall.gui.queryforge.panels;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.dei.perla.rockfall.gui.queryforge.IllegaParamValueException;
import org.dei.perla.rockfall.gui.queryforge.ReadableStatusPanel;

public class GainsStatusMemsXPanel extends ReadableStatusPanel {

	private JTextField jText4;
	
	public GainsStatusMemsXPanel(String title) {
		super(title);
	}


	@Override
	public int getStatus() throws IllegaParamValueException {
		int result = Integer.parseInt(jText4.getText());
		if(result > 255)
			throw new IllegaParamValueException("Parametro impostato troppo elevato per memsx (< 255)");
		return result;
	}

	@Override
	public void setStatus(int stato) {
		jText4.setText(Integer.toString(stato));
	}

	@Override
	protected void setupInternalComponents() {
		
		//Primo blocco di scelte
		
		jText4 = new JTextField();
		jText4.setColumns(10);
		JLabel jlabel4 = new JLabel("Guadagno mems asse X");
		JPanel jpanel4 = new JPanel();
		jText4.setText("0");
		BoxLayout layout4 = new BoxLayout(jpanel4, BoxLayout.X_AXIS);
		jpanel4.add(jlabel4);
		jpanel4.add(jText4);

				
		//aggiungo tutti i blocchi
		this.add(jpanel4);
		
	}

}
